@extends('admin.pop_edit')
@section('body')
    <form id="systemUserAddForm" action="{{admin_url($baseRoute.'save')}}" class="layui-form model-form">
        <div class="layui-col-xs6">
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">标题:</label>
                <div class="layui-input-block">
                    <input type="text" name="name" placeholder="请输入标题" class="layui-input"
                           lay-verType="tips" lay-verify="required" required/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label layui-form-required">职业:</label>
                <div class="layui-input-block">
                    <input type="text" name="career" placeholder="请输入职业" class="layui-input"
                           lay-verType="tips" lay-verify="required" required/>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">专业:</label>
                <div class="layui-input-block">
                    <x-code code="AS" name="specialty"></x-code>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">行业:</label>
                <div class="layui-input-block">
                    <x-code code="AI" name="industry"></x-code>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">城市:</label>
                <div class="layui-input-block">
                    <x-code code="AC" name="city"></x-code>
                </div>
            </div>
        </div>
        <div class="layui-col-xs6">
            <div class="layui-form-item">
                <label class="layui-form-label ">封面:</label>
                <div class="layui-input-block">
                    <button type="button" class="layui-btn" id="btnUploadLogo">
                        <i class="layui-icon">&#xe67c;</i>封面
                    </button><span style="color: red">图片尺寸:420*285</span>
                    <input type="hidden" name="avatar" id="hiLogoId">
                    <div style="max-width: 120px;height: 120px;">
                        <img src="{{\App\Facade\System\File::defaultImage()}}" onclick="SystemUtil.previewImg(this);" height="120" id="imgLogo">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">简介:</label>
            <div class="layui-input-block">
                <textarea class="layui-textarea" id="txtIntroduction" name="introduction"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">实战经历:</label>
            <div class="layui-input-block">
                <textarea class="layui-textarea" id="txtPracticalExperience" name="practical_experience"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">服务过的客户:</label>
            <div class="layui-input-block">
                <textarea class="layui-textarea" id="txtClientsServed" name="clients_served"></textarea>
            </div>
        </div>
        <div class="layui-form-item text-right">
            <button class="layui-btn" lay-filter="ajaxForm" lay-submit>@lang('common.save')</button>
            <button class="layui-btn layui-btn-primary" type="button"
                    ew-event="closeDialog">@lang('common.cancel')</button>
        </div>
    </form>
@stop
@push('script')
    <script type="text/javascript">
        SystemUtil.file.uploadImage('#btnUploadLogo', 1, function (id, url) {
            layui.$('#hiLogoId').val(url);
            layui.$('#imgLogo').prop('src', url);
        });
        layui.use(['form', 'admin', 'layedit'], function () {
            let txtIntroductionIndex = layui.layedit.build('txtIntroduction', {
                uploadImage: {
                    url: "{{admin_url('/file/editerImage')}}",
                    data: {obj: 1},
                    type: 'post'
                }
            });
            let txtPracticalExperienceIndex = layui.layedit.build('txtPracticalExperience', {
                uploadImage: {
                    url: "{{admin_url('/file/editerImage')}}",
                    data: {obj: 1},
                    type: 'post'
                }
            });
            let txtClientsServedIndex = layui.layedit.build('txtClientsServed', {
                uploadImage: {
                    url: "{{admin_url('/file/editerImage')}}",
                    data: {obj: 1},
                    type: 'post'
                }
            });

            layui.$('button[lay-filter="ajaxForm"]').mouseenter(function () {
                layui.layedit.sync(txtIntroductionIndex);
                layui.layedit.sync(txtPracticalExperienceIndex);
                layui.layedit.sync(txtClientsServedIndex);
            });
            layui.$('button[lay-submit]').not('button[lay-filter="ajaxForm"]').mouseenter(function () {
                layui.layedit.sync(txtIntroductionIndex);
                layui.layedit.sync(txtPracticalExperienceIndex);
                layui.layedit.sync(txtClientsServedIndex);
            });
        });
    </script>
@endpush
